import Sort from './Sort'

class Page {
  constructor ({
    last = false,
    totalPages = 0,
    totalElements = 0,
    sort = 0,
    first = false,
    numberOfElements = 0,
    size = 10,
    number = 0
  }) {
    this.last = last
    this.totalPages = totalPages
    this.totalElements = totalElements
    if (typeof sort === 'object') {
      this.sort = sort.map(v => new Sort(v))
    } else {
      this.sort = sort
    }
    this.first = first
    this.numberOfElements = numberOfElements
    this.size = size
    this.number = number
  }
}

export default Page
